--竞技场头条
---@class Billboard_SubRankUnlockTipPanel : UIComponentBase
local panel = Class("SubRankUnlockTipPanel",UIComponentBase)
local t = panel

function t:OnCreate()
    self.tip = self:GetChild("tips")
    self.title = self:GetChild("title")
    self.rewardItemList = self:GetList("rewardList")
    self.unlockItemList = self:GetList("reward")
    self:SetDynamicList(self.rewardItemList,self.RewardRender,self,true)
    self:SetDynamicList(self.unlockItemList,self.UnlockRender,self,true)
    self:LocalLanguage()
end
function t:LocalLanguage()
    self:GetChild("text1").text = getLanguage("NoticeTips12")
    self:GetChild("text2").text = getLanguage("NoticeTips13")
end
function t:Refresh(bigRank,subRank)
    self.bigRank = bigRank
    self.subRank = subRank
    --解锁奖
    local cfg = dataTable.getDataTableByMultiId("t_noticebase",bigRank,subRank)
    if cfg then
        self.unlockDataList = logicMgr.ItemManager.ParseRewards(cfg.f_Reward)
        self.unlockItemList.numItems = #self.unlockDataList
    end
    --低保奖
    local cfgList = dataTable.getDataTableByMultiId("t_noticerank",bigRank,subRank)
    local cfg = cfgList[#cfgList]
    self.rewardList = logicMgr.ItemManager.ParseRewards(cfg.f_Rewards)
    self.rewardItemList.numItems = #self.rewardList
    --tip
    local noticeBase = dataTable.getDataTableByMultiId("t_noticebase",bigRank,subRank)
    if not noticeBase then
        logError("找不到配置表t_noticebase: "..bigRank..","..subRank)
        return
    end
    local tb = decodeJsonStrToTabel(noticeBase.f_Power)
    self.tip.text = string.format(getLanguage("NoticeTips2"),tb[1])
    self:GetChild("title").text = string.format(getLanguage("NoticeTips11"),getLanguage("BillboardSubRank"..subRank))
end
function t:OnEnable()

end

function t:RewardRender(index,go)
    local data = self.rewardList[index]
    local c = CtrlManager.GetCtrl(PanelNames.Item)
    c.initData(go,data)
end
function t:UnlockRender(index,go)
    local data = self.unlockDataList[index]
    local c = CtrlManager.GetCtrl(PanelNames.Item)
    c.initData(go,data)
end

function t:OnDisable()
end
function t:OnDestroy()
end

function t:ClickRank()

end

return t